//////////////////////////////////
///生成时间:2012-02-17 14:38:59
///Model
//////////////////////////////////
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;

namespace yule.Model.Cms
{
    /// <summary>
    /// Cms分类(Cms_Type) (Cms_Type)
    /// </summary>
    [DataContract]
    [Serializable]
    public class Type : yule.Model.Base.Cms.Type, ITree<yule.Model.Cms.Type>
    {

        public new dynamic ParentId
        {
            get { return base.ParentId; }
            set { base.ParentId = value; }
        }

        #region ITree<Type> 成员


        public Type Parent
        {
            get
            {
                return Type.Select(this.ParentId);
            }
        }

        public string PathName
        {
            get
            {
                if (base.ParentName == null)
                {
                    base.ParentName = TreeHelper.GetPathName<Type>(this);
                }
                return base.ParentName;
            }
        }


        public new string PathId
        {
            get
            {
                if (base.ParentId == null)
                {
                    base.ParentId = TreeHelper.GetPathId<Type>(this);
                }
                return base.ParentId;
            }
        }

        public IList<Type> Childs
        {
            get
            {
                return yule.Common.ServiceManager.ServiceContext.CreateService<yule.IDAL.Cms.IType>().GetChilds(this.Id);
            }
        }

        public int Level
        {
            get
            {
                return TreeHelper.GetLevel<yule.Model.Cms.Type>(this);
            }
        }

        #endregion
    }
}